package com.ct.application.state;

import com.ct.state.model.StateCardModel;
import com.ct.state.model.StateOrderModel;
import com.ct.state.model.StateOsBroswerModel;
import com.ct.state.model.StateProvinceCityModel;
import com.ct.state.responsity.IStateResponsity;
import com.ct.utils.threadlocal.UserThreadLocal;
import jakarta.annotation.Resource;
import org.springframework.stereotype.Repository;

import java.util.List;

/**
 * <p>
 * 系统日志 Mapper 接口
 * </p>
 *
 * @author Auto Generator
 * @since 2023-08-17
 */
@Repository
public class StateServiceImpl implements IStateService {

    @Resource
    private IStateResponsity stateResponsity;

    /**
     * 统计四个卡片数据信息
     * @return
     */
    @Override
    public StateCardModel stateCard(){
        return stateResponsity.stateCard(UserThreadLocal.get().getSystemId());
    }

    /**
     * 统计用户城市占比
     * @param type
     * @return
     */
    @Override
    public List<StateProvinceCityModel> statePCData(String type){
        return stateResponsity.statePCData(UserThreadLocal.get().getSystemId(),type);
    }

    /**
     * 统计订单占比
     * @param type
     * @return
     */
    @Override
    public List<StateOrderModel> stateOrderData(String type){
        return stateResponsity.stateOrderData(UserThreadLocal.get().getSystemId(),type);
    }

    /**
     * 统计os和浏览器占比
     * @return
     */
    @Override
    public List<StateOsBroswerModel> statePlatformDataBroswer(){
        return stateResponsity.statePlatformData(UserThreadLocal.get().getSystemId(),"broswer");
    }

    /**
     * 统计os和浏览器占比
     * @return
     */
    @Override
    public List<StateOsBroswerModel> statePlatformDataOS(){
        return stateResponsity.statePlatformData(UserThreadLocal.get().getSystemId(),"os");
    }
}
